package day09API.object;

import java.util.Date;
import java.util.Objects;

public class Demo02 {
    private int x;
    private int y;

    public Demo02(int x, int y) {
        this.x = x;
        this.y = y;
    }
    public Demo02() {
    }

    public static void main(String[] args) {
        Demo02 demo02 = new Demo02(1,4);
        Demo02 demo = new Demo02(1,4);
        System.out.println(demo == demo02);
        System.out.println(demo.equals(demo02));
        long time1 = System.currentTimeMillis();
        System.out.println(time1);
        Date date = new Date(time1);
        System.out.println(date);


        Integer i1 = 20;
        Integer i2 = 20;
        System.out.println(i1 == i2);
        Integer i3 = 128;
        Integer i4 = 128;
        System.out.println(i3 == i4);//界限为-128-->127

        String str = "1234";
        int i = Integer.valueOf(str)*10;
        int i5 = Integer.parseInt(str)*100;
        System.out.println(i);
        System.out.println(i5);
        String str1 = "3.14";
        double d= Double.valueOf(str1)*4;
        double d1 = Double.parseDouble(str1)*6;
        System.out.println(d);
        System.out.println(d1);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Demo02 demo02 = (Demo02) o;
        return x == demo02.x &&
                y == demo02.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }

    @Override
    public String toString() {
        return "Demo02{" +
                "x=" + x +
                ", y=" + y +
                '}';
    }
}
